Avorion Script API Documentation

Player [Client]

This object is only available on the client.

function Player()

Returns

A new instance of Player

property Alliance alliance[read-only]
property var allianceIndex[read-only]
property vec3 cameraAt[read-only]
property vec3 cameraEye[read-only]
property Matrix cameraPosition[read-only]
property vec3 cameraUp[read-only]
property Entity craft
property UserObject craftFaction[read-only]
property Uuid craftId
property Uuid craftIndex
property string fullLogId[read-only]
property Group group[read-only]
property int index[read-only]
property bool infiniteResources
property bool isAIFaction[read-only]
property bool isAlliance[read-only]
property bool isBehemothDLCInstalled[read-only]
returns true if the Behemoth DLC is owned and installed according to local Steam
property bool isBlackMarketDLCInstalled[read-only]
returns true if the Black Market DLC is owned and installed according to local Steam
property bool isInteracting[read-only]
property bool isIntoTheRiftDLCInstalled[read-only]
returns true if the Into The Rift DLC is owned and installed according to local Steam
property bool isPlayer[read-only]
property Material maxBuildableMaterial
property int maxBuildableSockets
property unsigned int maxNumMails[read-only]
property var maxNumShips[read-only]
property var maxNumStations[read-only]
property int money[read-only]
property var name[read-only]
property unsigned int numMails[read-only]
property unsigned int numShips[read-only]
property bool ownsBehemothDLC[read-only]
returns true if the player owns the Behemoth DLC according to server
property bool ownsBlackMarketDLC[read-only]
returns true if the player owns the Black Market DLC according to server
property bool ownsIntoTheRiftDLC[read-only]
returns true if the player owns the Into The Rift DLC according to server
property Entity selectedObject
property PlayerStateType state[read-only]

function var addComparisonItem(var item)

Returns

nothing

function bool, string buildingAllowed(Entity entity)

function int callbacksRegistered(string callbackName, var functionName)

Check how many functions are registered to a callback from the current script VM.

Parameters

callbackName The name of the callback
functionName The name of the function for which to check. If nil, will count all functions that are registered to this callback.

Returns

The amount of functions registered to the callback

function bool, string, table<int, string> canPay()

function Relation... getAllRelations()

function int, int getHomeSectorCoordinates()

function Entity getInteractedEntity()

function Inventory getInventory()

function SectorView getKnownSector(int x, int y)

function ivec2... getKnownSectorCoordinates()

function SectorView... getKnownSectors()

function SectorView... getKnownSectorsOfFaction(int factionIndex)

function SectorView... getKnownSectorsWithFaction(int factionIndex)

function Mail getMail(unsigned int index)

function string... getNamesOfShipsInSector(int x, int y)

function PlanStyle getPlanStyle(string name)

function string... getPlanStyleNames()

function int, int getReconstructionSiteCoordinates()

function Relation getRelation(int factionIndex)

function int getRelations(int factionIndex)

function int getRelationStatus(int factionIndex)

function unsigned int... getResources()

function table<int, string> getScripts()

function var getSelectionGroup(int index)

function var getSelectionGroups()

function var getShipAvailability(string name)

function Box getShipBoundingBox(string name)

function bool getShipCanPassRifts(string name)

function string getShipCargo(string name)

function table<TradingGood, int> getShipCargos(string name)

function var getShipDestroyed(string name)

function float getShipHyperspaceReach(string name)

function string getShipIcon(string name)

function string... getShipNames()

function var getShipOrderInfo(string name)

function float getShipPayment(string name)

function float getShipPaymentTime(string name)

function BlockPlan getShipPlan(string name)

function var... getShipPosition(string name)

function double getShipReconstructionValue(string name)

function string getShipStatus(string name)

function pair... getShipSystems(string name)

function table<int, TurretDesign> getShipTurretDesigns(string name)

function int getShipType(string name)

function var getValue(string name)

function bool hasScript(string name)

function var... invokeFunction(var scriptName, string functionName, var... arguments)

Invokes a function in a script of the player. Use this function to invoke functions from one script in another script. The first return value of the function is an integer indicating whether or not the call was successful. When it was, this integer is followed by the return values of the invoked function.

Parameters

scriptName The name of the script containing the function
functionName The name of the function that will be executed
arguments An arbitrary list of arguments that will be given to the invoked function. Only numbers, std::strings and nil are supported here.

Returns

Returns at least 1 value indicating if the call succeeded:
0 The call was successful. In this case, the return values of the script are returned in addition to the call result, following the call result.
3 The call failed because the given script was not found in the player.
4 The call failed because the given function was not found in the script.
5 The call failed because the script's state has errors and is invalid

function bool knowsFaction(int factionIndex)

function bool knowsSector(int x, int y)

function bool ownsShip(string name)

function var registerCallback(string callbackName, string functionName)

Register a callback in the player. The callback will be removed when the sector is changed or the receiver, if it's an entity, is destroyed. Double registration of callbacks doesn't work. When the same callback to the same callback of the same script instance is registered twice, it will still only be called once.

Parameters

callbackName The name of the callback
functionName The name of the function that will be executed in the script when the callback happens

Returns

nothing

function var sendCallback()

Returns

nothing

function var sendChatMessage(var content, var channel)

Returns

nothing

function var setCameraKeyFrames()

Returns

nothing

function var setFollowCamera(var entity)

Returns

nothing

function var setSelectionGroup(int index, var group_in)

Returns

nothing

function var startBuilding(Entity entity)

Returns

nothing

function var startInteracting(Entity entity, string scriptName, int optionIndex)

Returns

nothing

function var stopInteracting()

Returns

nothing

function var unregisterCallback(string callbackName, string functionName)

Returns

nothing

Overview
Home Functions Search
Search:

This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.

Work in Progress. Documentation of Avorion Version: 2.5.7 c8e4beec84f7